#!/bin/sh
cd $2
file=/tmp/$3.temp
if [ ! -f "$file" ]; then
  touch "$file"
fi
tail -n $1 $3> $file